package web.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import web.controller.address_telefon.CreateNewTelephoneBookController;

public class VoteForASpecificVotingController {

	private static final Log logger = LogFactory.getLog(CreateNewTelephoneBookController.class);
	
	private String eMail;
	private String password;
	private String votingIDNumbers;
	private String votingDesired;
	
	public VoteForASpecificVotingController() {
		// TODO Auto-generated constructor stub
	}

	
	public String showVoting(){
		
		String pageToRedirect = "";
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		try {
			pageToRedirect = "showVotingSuccess";
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	public String updateRegistrationInformation(){
		
		String pageToRedirect = "";
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		try {
			pageToRedirect = "updateRegistrationInformationSuccess";
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	public String showRegistrationInformation(){
		
		String pageToRedirect = "";
		
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		
		try {

			pageToRedirect = "showRegistrationInformationSucess";
			
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	public String cancelDisplayVoting(){
		
		String pageToRedirect = "";
		
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		
		try {

			pageToRedirect = "cancelDisplayVotingSuccess";
			
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	public String cancelUpdateRegistrationInformation(){
		
		String pageToRedirect = "";
		
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		try {
			pageToRedirect = "cancelUpdateRegistrationInformationSuccess";
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	public String forgotPassword(){
		
		String pageToRedirect = "";
		
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		
		try {

			pageToRedirect = "forgotPasswordSuccess";
			
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	private void confirmRegistration() {
		// connect to database and update registration status
		
	}
	
	public String cancelRegisterForVoting(){
		
		String pageToRedirect = "";
		
		if(!validateUserInput()){
			pageToRedirect = "";
			return pageToRedirect;
		}
		try {

			pageToRedirect = "insertNewUserSuccess";
			
		} catch (Exception exception) {
			logger.error("Yeni kullanici kaydederken hata olustu!", exception);
		}
		
		return pageToRedirect;
	}
	
	private boolean validateUserInput(){
		
		return true;
	}


	public String geteMail() {
		return eMail;
	}


	public void seteMail(String eMail) {
		this.eMail = eMail;
	}


	public String getPassword() {
		return password;
	}


	public void setPassword(String password) {
		this.password = password;
	}


	public String getVotingIDNumbers() {
		return votingIDNumbers;
	}


	public void setVotingIDNumbers(String votingIDNumbers) {
		this.votingIDNumbers = votingIDNumbers;
	}


	public String getVotingDesired() {
		return votingDesired;
	}


	public void setVotingDesired(String votingDesired) {
		this.votingDesired = votingDesired;
	}


	
}
